var app = getApp();
Page({
  data: {
   
  },
  onShareAppMessage: function () {
    return {
      title: this.data.card.comName+','+this.data.card.user.userName + '的名片,请惠存',
      path: 'myInfo-detail/myInfo-detail?cardId=' + this.data.card.id + '&isHidden=' + false
    }
  },


  // 向上滑动事件
  pullUp: function (ty) {
    console.log("向上滑动事件")

  },
  // 下拉事件
  dropDown: function (ty) {
    console.log("下拉事件")

    if (ty > 30) {
      wx.showToast({
        title: '收藏成功',
        icon: 'success',
        duration: 2000
      })
    }
  },

  onLoad: function (option) {
    var that = this;
    var isHidden2 = option.isHidden;
    var abc = option.abc;
   
    if (isHidden2 =='true'){
    var userId = option.userId;
    wx.request({
      url: 'http://localhost:8080/findById?id='+userId,
      method:"GET",
      success:function(res){
        var user = res.data.userInfo;
        that.setData({
          user:user,
          isHidden:true
        })
      }
    })
  }else{
      var cardId = option.cardId;
      wx.request({
        url: 'http://localhost:8080/UserCard/findById?id=' + cardId,
        method: "GET",
        success: function (res) {
          var card = res.data.UserCard;
          that.setData({
            card: card,
            isHidden: false
          })
        }
      })
  }
  }
})
